package com.qf.web;

import com.github.pagehelper.PageInfo;
import com.qf.pojo.Account;
import com.qf.service.AccountService;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class AccountController {

    public static void main(String[] args) {

        ApplicationContext ioc = new ClassPathXmlApplicationContext("spring.xml");

        AccountService accountService = ioc.getBean(AccountService.class);

//        List<Account> accounts = accountService.findAll();

//        accounts.forEach(System.out::println);

        PageInfo<Account> pageInfo = accountService.findPage(2, 2);

        System.out.println(pageInfo.getTotal());
        System.out.println(pageInfo.getPages());
        List<Account> accounts = pageInfo.getList();
        accounts.forEach(System.out::println);


    }
}
